﻿function MyTrace(obj,str){
	
	trace("OBJ:"+obj);
	if(typeof(obj)!="object") return;
	
	if(str==undefined){
		str="";
	}
	for(var i in obj){
		if(typeof(obj[i])=="object"){
			MyTrace(obj[i],str+"  ");
		}else{
			trace(str+"#["+i+"]: "+obj[i]);
		}
	}
}
function writeLog(msg){
	var cff=new File("Log.txt");
	if(!cff.exists){
		trace("create log file.");
		cff.open("text","create");
		cff.flush();
		cff.close();
		cff=new File("Log.txt");
		cff.open("text","write");
	}else{
		cff.open("text","append");
	}
	if(cff!=undefined){
		cff.writeln((new Date()).toString()+" - "+msg);
		cff.flush();
		cff.close();
	}
}